home *** CD-ROM | disk | FTP | other *** search
/ QRZ! Ham Radio 8 / QRZ Ham Radio Callsign Database - Volume 8.iso / pc / files / p_misc / netconf.arc / AUTHENT.TXT < prev    next >
Text File  |  1988-12-10  |  19KB  |  392 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.                             Another Look at Authentication
  11.  
  12.  
  13.                                    Phil Karn, KA9Q
  14.  
  15.  
  16.  
  17.                                        _A_B_S_T_R_A_C_T
  18.  
  19.                      A  simple  and  effective  technique  for  packet
  20.                 authentication in a datagram network is described that
  21.                 is based on the Data Encryption  Standard  (DES).   In
  22.                 accordance  with  FCC  rules,  the  actual data is not
  23.                 encrypted; rather DES is used  to  compute  a  special
  24.                 "cipher  checksum" that is appended to the unencrypted
  25.                 user data before transmission.  The  recipient  recom-
  26.                 putes  the cipher checksum and compares it against the
  27.                 incoming value, thereby  detecting  bogus  or  altered
  28.                 packets.   This  technique  is potentially useful in a
  29.                 wide variety of amateur radio applications in addition
  30.                 to  packet  radio;  for  example,  it  could provide a
  31.                 secure control link for a remote repeater site.
  32.  
  33.  
  34.  
  35.            _1.  _I_n_t_r_o_d_u_c_t_i_o_n
  36.  
  37.                 At the 5th ARRL Computer Networking Conference,  Hal  Fein-
  38.            stein  described  a  technique for authenticating amateur packet
  39.            transmissions [1] useful for protecting radio control links.  In
  40.            the commercial and military worlds, the solution is simple: just
  41.            encrypt everything. Not only does this protect against unauthor-
  42.            ized  commands from those not knowing the key, it also hides the
  43.            command information itself.  In the  amateur  service,  however,
  44.            this  is  prohibited by FCC rules. [2] The only exception is for
  45.            command links in the Amateur Satellite Service; [3] there is  no
  46.            corresponding exception for terrestrial links.
  47.  
  48.                 Fortunately, as Hal showed in his paper, a rule  change  is
  49.            not  necessary to add security legally to a control link.  Cryp-
  50.            tographic techniques can be used to add "authentication"  to  an
  51.            unencrypted  command to verify that it was sent by an authorized
  52.            station.  Hal assumed that a virtual circuit  would  be  set  up
  53.            between the control station and the remote site, and as a result
  54.            his technique is quite involved. I have devised  a  similar  but
  55.            much  simpler  approach  made  possible by the use of a datagram
  56.            protocol.
  57.  
  58.  
  59.  
  60.  
  61.  
  62.                                    December 6, 1988
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.            _2.  _T_h_e _D_a_t_a _E_n_c_r_y_p_t_i_o_n _S_t_a_n_d_a_r_d
  72.  
  73.                 As in Hal's approach, I use the  Data  Encryption  Standard
  74.            (DES).  [4,5]  A  full  description is outside the scope of this
  75.            paper; however, I will review two of its properties  since  they
  76.            are important to the proposed authentication scheme.
  77.  
  78.  
  79.            1.   The internals of DES are public knowledge, since  the  com-
  80.                 plete  specifications  have  been  widely published. Like a
  81.                 well-designed safe, however, knowing how  DES  works  isn't
  82.                 much help in cracking it; only the key (or the combination)
  83.                 need be secret for good security. This is what allowed  DES
  84.                 to  become the first-ever cryptographic standard; similarly
  85.                 it allows us to establish an amateur  authentication  stan-
  86.                 dard  so that each system operator doesn't have to reimple-
  87.                 ment the wheel.
  88.  
  89.            2.   In practice, DES has been highly resistant to "known plain-
  90.                 text"   attacks.    [6,7,8,9,10]   That  is,  even  with  a
  91.                 plaintext/ciphertext "matched pair", the  algorithm  is  so
  92.                 nonlinear that at present there is no known way (outside of
  93.                 the NSA, at least)  to  find  the  key  that  produced  the
  94.                 transformation  other  than by trying all possible 2 keys
  95.                 in the algorithm until you find the one that works.  As  we
  96.                 will  see, this property is very important to the authenti-
  97.                 cation scheme described here, since each transmission  con-
  98.                 tains  both  the ciphertext and the plaintext that produced
  99.                 it. It should be pointed out, however, that as yet there is
  100.                 no  published  mathematical  _p_r_o_o_f  that  a known-plaintext
  101.                 attack against DES requires an exhaustive  search.  Despite
  102.                 some  "suspicious"  structure in the algorithm that reduces
  103.                 the required brute-force effort  somewhat,  the  accusation
  104.                 that  a  "trap door" may have been planted in the algorithm
  105.                 by its designers has yet to be either proven or disproven.
  106.  
  107.                 As an aside, it  is  this  resistance  to  known  plaintext
  108.            attack that makes the M/A-Com Videocipher system (which encrypts
  109.            the audio with DES) so hard to break. Anyone can buy a box, sub-
  110.            scribe  to  a  service  and get millions of ciphertext/plaintext
  111.            pairs. However, that doesn't help in finding out the DES key  in
  112.            use, which you would need to build a pirate decoder.  The key is
  113.            kept inside the decryption device in a  battery-backed  register
  114.            which can't be read from the device pins. Only a physical attack
  115.            is likely to work here, e.g., dissolving the epoxy off the  chip
  116.            with  solvents  and reading the key from the exposed chip with a
  117.            scanning electron microscope of the type designed for  debugging
  118.            ICs  under  test.  This illustrates an important practical point
  119.            in cryptography: key security, not the mathematical strength  of
  120.            the encryption algorithm, is usually the weak link. Key security
  121.            is harder than you might think, especially when many people  are
  122.            involved.
  123.  
  124.  
  125.  
  126.                                    December 6, 1988
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.            _3.  _D_E_S _M_o_d_e_s _o_f _O_p_e_r_a_t_i_o_n
  136.  
  137.                 The basic  DES  algorithm  transforms  64-bit  data  blocks
  138.            between  plaintext and ciphertext form under control of a 56-bit
  139.            key. As long as the key is constant, enciphering a given  64-bit
  140.            data block always gives the same 64-bit block of ciphertext.  If
  141.            you encrypt data directly in this way, you are using DES in  the
  142.            Electronic  Code  Book  (ECB)  mode.  ECB can result in repeated
  143.            patterns when, for example, strings of blanks are encrypted.  To
  144.            avoid  this potential problem, several modes all involving feed-
  145.            back are recommended by the NBS. [11] One of  these  is  "cipher
  146.            block chaining" (CBC). In this mode, each 64-bit block of plain-
  147.            text is exclusive-ored with the DES ciphertext  output  for  the
  148.            _l_a_s_t  64-bit data block before being encrypted.  (Since there is
  149.            no preceding block of ciphertext the first block of plaintext is
  150.            instead  exclusive-ored  with a prearranged "initialization vec-
  151.            tor"). The ciphertext at a given point in the message  therefore
  152.            depends  on  _a_l_l  of the data preceding it, not just the current
  153.            block. Any change therefore "propagates" throughout the rest  of
  154.            the message.
  155.  
  156.            _4.  _A_u_t_h_e_n_t_i_c_a_t_i_o_n _W_i_t_h _D_E_S
  157.  
  158.                 This error-propagation property is the basis of the authen-
  159.            tication scheme, which can now be described.
  160.  
  161.                 Encrypt each packet with DES in the cipher  block  chaining
  162.            mode.  Then  send the original unencrypted packet along with the
  163.            last cipher  word  (64  bits)  of  the  encrypted  version.  The
  164.            receiver  also encrypts the packet and compares its final cipher
  165.            word with the received version; if they  match,  the  packet  is
  166.            accepted.   Changing  even  one  bit in the message results in a
  167.            completely unpredictable change in the cipher checksum with only
  168.            1 chance in 2 of escaping detection by the receiver.
  169.  
  170.                 This technique amounts to adding a "cipher checksum" to the
  171.            packet, an apt description since it functions much like an ordi-
  172.            nary checksum or CRC. The only difference is that the  "checksum
  173.            algorithm"  must  protect  against  corruption  or  spoofing  by
  174.            malevolent humans as well as by nature, and  therefore  must  be
  175.            more sophisticated.
  176.  
  177.                 For example, it would not be  sufficient  to  generate  the
  178.            cipher  checksum  by computing a normal checksum over the packet
  179.            and then encrypting it  before  transmission.  A  spoofer  could
  180.            carefully  construct  a  packet  to  have the same checksum as a
  181.            valid packet he had seen earlier on the channel, and then append
  182.            the  same  cipher  checksum.  The size of the cipher checksum is
  183.            also very important. Ordinary  checksums,  designed  to  protect
  184.            only  against  random natural corruption, are often only 16 bits
  185.            wide. It is not that impractical  to  try  all  65,536  possible
  186.            checksums  until  the  correct one is found by chance. Since the
  187.            cipher checksum produced by DES is 64 bits wide, trying all pos-
  188.            sible  values  is  out  of  the question. Naturally, such a wide
  189.  
  190.  
  191.                                    December 6, 1988
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.            field also provides superior protection  against  corruption  by
  201.            natural causes.
  202.  
  203.            _5.  _P_l_a_y_b_a_c_k _A_t_t_a_c_k_s
  204.  
  205.                 Hal's paper discusses in detail the problem of  the  "play-
  206.            back attack". Even though the bad guy might not be able generate
  207.            his own message or corrupt a  real  one  without  upsetting  the
  208.            authentication  mechanism, he could record and play back a valid
  209.            message at a later time in an attempt to repeat the same  opera-
  210.            tion.
  211.  
  212.                 However, using a transport (level 4) protocol designed  for
  213.            a  datagram  network neatly solves this problem.  Such protocols
  214.            are already designed to  detect  and  reject  duplicate  packets
  215.            arriving  minutes or even hours after the original. This protec-
  216.            tion is necessary because a datagram network  will  occasionally
  217.            deliver  a  long-delayed duplicate of a packet, usually when its
  218.            routing algorithm is trying to recover from a failing  or  cong-
  219.            ested  link. For example, TCP [12] uses 32-bit sequence numbers,
  220.            so over 4 gigabytes must be sent on a  given  connection  before
  221.            the  sequence numbers wrap around. In most implementations, sub-
  222.            sequent connections generally cycle through  all  possible  port
  223.            numbers on the originating end, and this adds another 16 bits to
  224.            the "sequence space". Even when the  exact  same  pair  of  port
  225.            numbers  is reused, a clock has incremented the initial sequence
  226.            number for the connection fast enough that it is  very  unlikely
  227.            to  reuse  the sequence numbers from the last incarnation of the
  228.            connection. In short, a properly implemented TCP can go  a  _v_e_r_y
  229.            long  time before it reuses the exact same combination of source
  230.            address, destination address,  source  port,  destination  port,
  231.            send  sequence  number  and receive sequence number, long enough
  232.            for the DES key to have been conveniently changed in  the  mean-
  233.            time!
  234.  
  235.                 Connectionless,  transaction-oriented  transport  protocols
  236.            (such as might be used for the remote control of a packet switch
  237.            or repeater) can protect against  duplicates  in  several  ways:
  238.            with sequence numbers as in a connection oriented protocol, with
  239.            timestamping (rejecting packets older than some  limit),  or  by
  240.            designing  the set of commands in an "idempotent" fashion, which
  241.            means that receiving a command more than once causes no  further
  242.            change in the state of the system being controlled.
  243.  
  244.            _6.  _I_m_p_l_e_m_e_n_t_a_t_i_o_n _I_s_s_u_e_s
  245.  
  246.                 How could a cipher checksum be added  to  TCP/IP,  and  how
  247.            much  of the packet should it cover? If the authentication is to
  248.            be end-to-end, it can't include the IP  header,  [13]  since  at
  249.            least the time-to-live (TTL) field is modified by each IP packet
  250.            switch.  The  data  covered  by  the  cipher  checksum  must  be
  251.            delivered  unchanged for the cipher checksum to be valid; there-
  252.            fore it should cover only the  data  following  the  IP  header.
  253.            While  this would seem to open up devious opportunities based on
  254.  
  255.  
  256.                                    December 6, 1988
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.            modifying the IP header, this really isn't a  problem.  TCP  and
  266.            UDP  [14] incorporate "pseudo-headers" into their checksum algo-
  267.            rithms that include the IP  source  and  destination  addresses,
  268.            protocol  type  and data length. Changing any of these fields in
  269.            the IP header would result in a checksum error when  the  packet
  270.            reaches the destination, and of course any attempt to modify the
  271.            checksum field in the TCP or UDP header would be detected by the
  272.            cipher checksum.
  273.  
  274.                 Another question is, where should the cipher  checksum  go?
  275.            It  would  be  nice to find a place to put it that wouldn't make
  276.            the resulting datagram incompatible with versions of TCP/IP that
  277.            didn't  understand  it.  This  suggests placing it in one of the
  278.            option fields, either in IP or TCP (assuming TCP is  used).   If
  279.            it  is  put  in  the  TCP  options  field, one runs afoul of the
  280.            specification that says options should be present  only  in  SYN
  281.            segments   (connection  requests).  New  TCP  options  are  also
  282.            discouraged.  This leaves the IP options field, of  which  there
  283.            are  relatively  many, some of which are not understood by every
  284.            implementation. To allow for this, option codes  always  include
  285.            the  length of the option, so that an unknown option type can be
  286.            skipped over.  Putting the cipher checksum  into  an  IP  option
  287.            also  allows  it  to be used with transport protocols other than
  288.            TCP (e.g., UDP).
  289.  
  290.                 Other minor issues, such as padding and the choice of  ini-
  291.            tialization  vector, are easily resolved. Since the DES CBC mode
  292.            operates on 8-byte blocks of data, data fields not a multiple of
  293.            8  bytes long should be padded out with zeros before encryption.
  294.            The initialization vector (IV) required  by  the  CBC  algorithm
  295.            could  serve  as  an  additional  key  element; it would be then
  296.            necessary to know both the 56-bit DES key and the 64-bit  IV  in
  297.            order  to  generate  and  check authenticators.  For the sake of
  298.            simplicity, however, the  IV  should  probably  be  standardized
  299.            (e.g., all zeroes) and only the DES key used for security.
  300.  
  301.            _7.  _S_u_m_m_a_r_y
  302.  
  303.                 Authentication is far easier to  implement  in  a  datagram
  304.            network  than  in  one based on virtual circuits, resulting in a
  305.            much simpler and more elegant design.  Since there is  only  one
  306.            type  of packet at the datagram level, there is only one type of
  307.            authentication operation. There is no need for a  "session  key"
  308.            or "challenge" at the beginning of a connection should one exist
  309.            at a  higher  protocol  layer.  Each  datagram  is  individually
  310.            authenticated  to protect it against spoofing or corruption, and
  311.            eliminating the possibility of a bad guy taking over  a  connec-
  312.            tion  (assuming  one exists) after it has been established.  The
  313.            measures already in place  to  protect  against  the  accidental
  314.            packet  duplication possible in a datagram network automatically
  315.            guard against playback attacks.
  316.  
  317.                 A public-domain implementation of DES  in  C  is  available
  318.            from the author.
  319.  
  320.  
  321.                                    December 6, 1988
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.            _8.  _R_e_f_e_r_e_n_c_e_s
  331.  
  332.            1.   Feinstein, Hal, WB3KDU, "Authentication of the Packet Radio
  333.                 Switch Control Link", Proceedings of the ARRL Amateur Radio
  334.                 5th Computer Networking Conference, p 5.72.
  335.  
  336.            2.   Federal  Communication  Commission  rules,  Section  97.117
  337.                 (Codes and Ciphers Prohibited).
  338.  
  339.            3.   Ibid, section 97.421(a) (Telecommand Operation).
  340.  
  341.            4.   Federal Information Processing  Standards  Publication  46,
  342.                 "Data Encryption Standard", January 15, 1977.
  343.  
  344.            5.   American National Standards Institute,  "American  National
  345.                 Standard Data Encryption Algorithm", ANSI X3.92-1981.
  346.  
  347.            6.   Davio, et al,  "Analytical  Characteristics  of  the  DES",
  348.                 Crypto '83, Santa Barbara.
  349.  
  350.            7.   Sugarman, "On Foiling Computer Crime", IEEE Spectrum,  July
  351.                 1979.
  352.  
  353.            8.   Davies, "Some Regular Properties of  the  'Data  Encryption
  354.                 Standard'  Algorithm",  National  Physical Laboratory, Ted-
  355.                 dington, Middlesex, UK.
  356.  
  357.            9.   Lexar Corporation, "An Evaluation of the NBS  Data  Encryp-
  358.                 tion Standard".
  359.  
  360.            10.  Branstad et al, "Report of the Workshop on Cryptography  in
  361.                 Support of Computer Security", National Bureau of Standards
  362.                 report NBSIR 77-1291.
  363.  
  364.            11.  Federal  Information  Processing   Standards   Publication,
  365.                 "Announcing the Standard for DES Modes of Operation".
  366.  
  367.            12.  Postel, ed, "Transmission Control Protocol  Specification",
  368.                 ARPA RFC 793.
  369.  
  370.            13.  Postel, ed, "Internet  Protocol  Specification",  ARPA  RFC
  371.                 791.
  372.  
  373.            14.  Postel, ed, "User Datagram Protocol", ARPA RFC 768.
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.                                    December 6, 1988
  386.  
  387.  
  388. 
  389.